﻿USE [store]
GO
ALTER TABLE [dbo].[Product] DROP CONSTRAINT [FK_Category]

GO
USE [master]
GO
/****** Object:  Database [store]    Script Date: 11/2/2013 11:30:06 AM ******/
DROP DATABASE [store]
GO
/****** Object:  Database [store]    Script Date: 11/2/2013 11:30:06 AM ******/
CREATE DATABASE [store]

ALTER DATABASE [store] SET COMPATIBILITY_LEVEL = 110
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [store].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [store] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [store] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [store] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [store] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [store] SET ARITHABORT OFF 
GO
ALTER DATABASE [store] SET AUTO_CLOSE ON 
GO
ALTER DATABASE [store] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [store] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [store] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [store] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [store] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [store] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [store] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [store] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [store] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [store] SET  ENABLE_BROKER 
GO
ALTER DATABASE [store] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [store] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [store] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [store] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [store] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [store] SET READ_COMMITTED_SNAPSHOT OFF 
GO
ALTER DATABASE [store] SET HONOR_BROKER_PRIORITY OFF 
GO
ALTER DATABASE [store] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [store] SET  MULTI_USER 
GO
ALTER DATABASE [store] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [store] SET DB_CHAINING OFF 
GO
ALTER DATABASE [store] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO
ALTER DATABASE [store] SET TARGET_RECOVERY_TIME = 0 SECONDS 
GO
USE [store]
GO
/****** Object:  Table [dbo].[Category]    Script Date: 11/2/2013 11:30:06 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Category](
	[CategoryID] [int] IDENTITY(1,1) NOT NULL,
	[ParentID] [int] NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[Description] [nvarchar](500) NULL,
	[Number] [int] NULL,
	[Active] [bit] NULL,
	[ModifiedDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[CategoryID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[MainMenu]    Script Date: 11/2/2013 11:30:06 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MainMenu](
	[MainMenuID] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](100) NOT NULL,
	[Pathlink] [nvarchar](100) NULL,
	[Number] [int] NULL,
	[Active] [int] NULL,
	[ModifiedDate] [datetime] NULL,
PRIMARY KEY CLUSTERED 
(
	[MainMenuID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
/****** Object:  Table [dbo].[Modules]    Script Date: 11/2/2013 11:30:06 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Modules](
	[ModulesID] [int] IDENTITY(1,1) NOT NULL,
	[Title] [nvarchar](200) NOT NULL,
	[Postion] [varchar](20) NOT NULL,
	[ModulesType] [nvarchar](50) NOT NULL,
	[Options] [xml] NULL,
	[Active] [bit] NULL,
	[ModifiedDate] [datetime] NULL,
	[SortNumber] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[ModulesID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Product]    Script Date: 11/2/2013 11:30:06 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Product](
	[ProductID] [int] IDENTITY(1,1) NOT NULL,
	[CategoryID] [int] NOT NULL,
	[ProductCode] [nvarchar](50) NULL,
	[ProductName] [nvarchar](100) NOT NULL,
	[ShortDesciption] [nvarchar](400) NULL,
	[DetailDescription] [nvarchar](1000) NULL,
	[UnitPrice] [money] NOT NULL,
	[OldPrice] [money] NULL,
	[Color] [varchar](100) NULL,
	[Picture] [varchar](200) NULL,
	[Size] [varchar](100) NULL,
	[CountView] [int] NULL,
	[Active] [bit] NULL,
	[ModifiedDate] [datetime] NULL,
	[Sales] [float] NULL,
PRIMARY KEY CLUSTERED 
(
	[ProductID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[Slides]    Script Date: 11/2/2013 11:30:06 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Slides](
	[Number] [int] NOT NULL,
	[Title] [nvarchar](200) NOT NULL,
	[SubTitle] [nvarchar](500) NOT NULL,
	[PathImages] [varchar](200) NOT NULL,
	[ModifiedDate] [datetime] NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Category] ON 

GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (1, 0, N'Thời trang nam', NULL, 0, 1, NULL)
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (2, 0, N'Thời trang nữ', NULL, 0, 1, CAST(0x0000A249005E1363 AS DateTime))
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (6, 2, N'Túi xách', NULL, 0, 1, NULL)
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (7, 2, N'Áo khoác nữ', NULL, 0, 1, CAST(0x0000A25200B9F03B AS DateTime))
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (8, 2, N'Váy áo', NULL, 0, 1, NULL)
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (9, 2, N'Sơ mi', NULL, 0, 1, CAST(0x0000A25500EE419C AS DateTime))
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (10, 2, N'Quần jeans', NULL, 0, 1, CAST(0x0000A25500EE5876 AS DateTime))
GO
INSERT [dbo].[Category] ([CategoryID], [ParentID], [Name], [Description], [Number], [Active], [ModifiedDate]) VALUES (11, 2, N'Áo thu đông', NULL, 0, 1, CAST(0x0000A25500EE7364 AS DateTime))
GO
SET IDENTITY_INSERT [dbo].[Category] OFF
GO
SET IDENTITY_INSERT [dbo].[Modules] ON 

GO
INSERT [dbo].[Modules] ([ModulesID], [Title], [Postion], [ModulesType], [Options], [Active], [ModifiedDate], [SortNumber]) VALUES (2, N'Sản phẩm mới', N'center', N'Product', N'<Option CategoryID="0" Display="20" />', 1, CAST(0x0000A2580124ECF2 AS DateTime), 1)
GO
INSERT [dbo].[Modules] ([ModulesID], [Title], [Postion], [ModulesType], [Options], [Active], [ModifiedDate], [SortNumber]) VALUES (3, N'Sản phẩm hot', N'center', N'Product', N'<Option CategoryID="0" Display="4" />', 1, CAST(0x0000A258012FA992 AS DateTime), 2)
GO
INSERT [dbo].[Modules] ([ModulesID], [Title], [Postion], [ModulesType], [Options], [Active], [ModifiedDate], [SortNumber]) VALUES (4, N'sản phẩm không bán được', N'center', N'Product', N'<Option CategoryID="0" Display="20" />', 1, CAST(0x0000A26300045A68 AS DateTime), 0)
GO
SET IDENTITY_INSERT [dbo].[Modules] OFF
GO
SET IDENTITY_INSERT [dbo].[Product] ON 

GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (10, 2, N'1108201353', N'Bộ chấm bi', NULL, NULL, 230000.0000, 0.0000, NULL, N',1873652495.jpg,1932657760.jpg', NULL, NULL, 1, NULL, 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (11, 2, N'2031423265', N'Váy', NULL, NULL, 240000.0000, NULL, NULL, N',-536724891.jpg,415612168.jpg', NULL, NULL, 1, CAST(0x0000A25500DD16F9 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (12, 2, N'1671428367', N'Váy chấm bi to', NULL, NULL, 250000.0000, NULL, NULL, N',1708764325.jpg', NULL, NULL, 1, CAST(0x0000A25500DD66B5 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (13, 2, N'1242576929', N'Bộ xám', NULL, NULL, 250000.0000, NULL, NULL, N',-890097236.jpg', NULL, NULL, 1, CAST(0x0000A25500DD88C8 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (14, 2, N'968576704', N'Quần bò xanh', NULL, NULL, 340000.0000, NULL, NULL, N',1821838433.jpg,1097397723.jpg', NULL, NULL, 1, CAST(0x0000A25500DDC87B AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (15, 2, N'433477143', N'Áo len sọc ngang', NULL, NULL, 100000.0000, NULL, NULL, N',-1458886451.jpg', NULL, NULL, 1, CAST(0x0000A25500DE0369 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (16, 2, N'69442777', N'Sơ mi', NULL, NULL, 190000.0000, NULL, NULL, N',790302523.jpg', NULL, NULL, 1, CAST(0x0000A25500EE0F63 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (17, 11, N'1662263902', N'Áo len 2', NULL, NULL, 150000.0000, NULL, NULL, N',-1828602343.jpg,1067049899.jpg', NULL, NULL, 1, CAST(0x0000A25500EEE33F AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (18, 11, N'1426985681', N'Áo khoác bò', NULL, NULL, 190000.0000, NULL, NULL, N',-825122107.jpg', NULL, NULL, 1, CAST(0x0000A25500EF2123 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (19, 8, N'917753693', N'Bộ váy áo 1', NULL, NULL, 170000.0000, NULL, NULL, N',-945199696.jpg', NULL, NULL, 1, CAST(0x0000A25500EF63C6 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (20, 2, N'2005476472', N'Áo phông 1', NULL, NULL, 150000.0000, NULL, NULL, N',-250399114.jpg', NULL, NULL, 1, CAST(0x0000A255017C5295 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (21, 7, N'1700853127', N'Áo phông kẻ ngang', NULL, NULL, 150000.0000, NULL, NULL, N',1940212001.jpg', NULL, NULL, 1, CAST(0x0000A255017CD221 AS DateTime), 0)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (22, 8, N'606916365', N'Váy hoa', NULL, NULL, 200000.0000, NULL, NULL, N',-110519330.jpg', NULL, NULL, 1, CAST(0x0000A255017D5E7E AS DateTime), 15)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (23, 8, N'313941748', N'Váy hoa 2', NULL, NULL, 200000.0000, NULL, NULL, N',-1756026287.jpg', NULL, NULL, 1, CAST(0x0000A255017D7CDC AS DateTime), 30)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (24, 8, N'554235508', N'Váy hồng', NULL, NULL, 250000.0000, NULL, NULL, N',1373869884.jpg', NULL, NULL, 1, CAST(0x0000A255017D9DB5 AS DateTime), 20)
GO
INSERT [dbo].[Product] ([ProductID], [CategoryID], [ProductCode], [ProductName], [ShortDesciption], [DetailDescription], [UnitPrice], [OldPrice], [Color], [Picture], [Size], [CountView], [Active], [ModifiedDate], [Sales]) VALUES (25, 2, N'643190892', N'Áo phông 2', NULL, NULL, 300000.0000, 0.0000, NULL, N',449602732.jpg', NULL, NULL, 1, CAST(0x0000A257010B03BF AS DateTime), 30)
GO
SET IDENTITY_INSERT [dbo].[Product] OFF
GO
ALTER TABLE [dbo].[Category] ADD  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Category] ADD  DEFAULT (getdate()) FOR [ModifiedDate]
GO
ALTER TABLE [dbo].[MainMenu] ADD  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[MainMenu] ADD  DEFAULT (getdate()) FOR [ModifiedDate]
GO
ALTER TABLE [dbo].[Modules] ADD  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Modules] ADD  DEFAULT (getdate()) FOR [ModifiedDate]
GO
ALTER TABLE [dbo].[Product] ADD  DEFAULT ((1)) FOR [CountView]
GO
ALTER TABLE [dbo].[Product] ADD  DEFAULT ((1)) FOR [Active]
GO
ALTER TABLE [dbo].[Product] ADD  DEFAULT (getdate()) FOR [ModifiedDate]
GO
ALTER TABLE [dbo].[Slides] ADD  DEFAULT (getdate()) FOR [ModifiedDate]
GO
ALTER TABLE [dbo].[Product]  WITH CHECK ADD  CONSTRAINT [FK_Category] FOREIGN KEY([CategoryID])
REFERENCES [dbo].[Category] ([CategoryID])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[Product] CHECK CONSTRAINT [FK_Category]
GO
USE [master]
GO
ALTER DATABASE [store] SET  READ_WRITE 
GO
